package leetcodecompetition.D361;

import java.util.Arrays;

/**
 * @Author: Siantar
 * @Date: 2023-09-03-10:31
 * @Description: 1.0
 */
public class T7020 {
    public int countSymmetricIntegers(int low, int high) {
        int res = 0;
        for (int i = low; i <= high; i++) {
            if (f(i)) {
                System.out.println(i);
                res++;
            }
        }
        return res;
    }

    public boolean f(int t) {
        String s = String.valueOf(t);
        if (s.length() % 2 == 1) return false;
        int n = s.length();
        int left=0,right=0;
        for(int i:s.substring(0, n / 2).toCharArray()){
            left+=i;
        }
        for(int i:s.substring( n / 2,n).toCharArray()){
            right+=i;
        }
        return left == right;
    }
}
